$(function () {
    echart_1();
    echart_2();
    echart_3();
   // echart_map();
	echart_4();
	echart_6();
	echart_8();
	echart_9();
	echart_7();
	echart_10();
	getycxbz();
	function getycxbz(){
		 $.ajax({
				url : "/sys/clQtbzCjrzfbz/getycxbz",
				contentType : "application/json",
	         	dataType : 'json',
				data : JSON.stringify(),
	          	type:'post',
				success : function(data) {
					echart_11(data.data);
				
				}
			}); 
}
    //echart_1湖南货物收入
    function echart_1() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('chart_1'));
        myChart.clear();
        option = {
            title: {
                text: ''
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data:['残疾人总数','低保残疾人数量','非低保残疾人数量'],
                textStyle:{
                    color: '#333'
                },
                top: '8%'
            },
            grid: {
                top: '40%',
                left: '3%',
                right: '7%',
                bottom: '3%',
                containLabel: true
            },
            color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['2019年','2020年','2021年'],
                splitLine: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '#333'
                    }
                }
            },
            yAxis: {
                name: '',
                type: 'value',
                splitLine: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '#333'
                    }
                }
            },
            series: [
                {
                    name:'残疾人总数',
                    type:'line',
                    data:[ 800,900,1000]
                },
                {
                    name:'低保残疾人数量',
                    type:'line',
                    data:[ 400,500,800]
                },
                {
                    name:'非低保残疾人数量',
                    type:'line',
                    data:[ 400,400,200]
                }
                
            ]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
        window.addEventListener("resize", function () {
            myChart.resize();
        });
    }

    //电子商务销售额、订单数
    function echart_2() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('chart_2'));
        myChart.clear();
        option = {
        		 tooltip: {
        		        trigger: 'axis',
        		        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
        		            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        		        }
        		    },
        		    legend: {
        		        data: [ '2019', '2020', '2021']
        		    },
        		    grid: {
        		        left: '3%',
        		        right: '4%',
        		        bottom: '3%',
        		        containLabel: true
        		    },
        		    xAxis: [
        		        {
        		            type: 'category',
        		            data: ['18-30(岁)', '31-44(岁)', '45-65(岁)',  '65以上']
        		        }
        		    ],
        		    yAxis: [
        		        {
        		            type: 'value'
        		        }
        		    ],
        		    series: [
        		        
        		        {
        		            name: '2019',
        		            type: 'bar',
        		            emphasis: {
        		                focus: 'series'
        		            },
        		            data: [120, 132, 101, 134]
        		        },
        		        {
        		            name: '2020',
        		            type: 'bar',
        		            emphasis: {
        		                focus: 'series'
        		            },
        		            data: [60, 72, 71, 74]
        		        },
        		        {
        		            name: '2021',
        		            type: 'bar',
        		            emphasis: {
        		                focus: 'series'
        		            },
        		            data: [62, 82, 91, 84]
        		        }
            ]
        };
        myChart.setOption(option);
    }


    //echart_3货物周转量
    function echart_3() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('chart_3'));
        myChart.clear();
        option = {
            title: {
                text: ''
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data:['总次数','总金额'],
                textStyle:{
                    color: '#333'
                },
                top: '8%'
            },
            grid: {
                top: '40%',
                left: '3%',
                right: '7%',
                bottom: '3%',
                containLabel: true
            },
            color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['2019年','2020年','2021年'],
                splitLine: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '#333'
                    }
                }
            },
            yAxis: {
                name: '元/人',
                type: 'value',
                splitLine: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '#333'
                    }
                }
            },
            series: [
                {
                    name:'总次数',
                    type:'line',
                    data:[36, 37,26,31]
                },
                {
                    name:'总金额',
                    type:'line',
                    data:[ 32000,36000,48000]
                }
            ]
        };
        myChart.setOption(option);
    }
	
	function echart_4() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('chart_4'));
        option = {
                title: {
                    text: ''
                },
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data:['总人数','总金额'],
                    textStyle:{
                        color: '#333'
                    },
                    top: '8%'
                },
                grid: {
                    top: '40%',
                    left: '3%',
                    right: '7%',
                    bottom: '3%',
                    containLabel: true
                },
                color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: ['2019年','2020年','2021年'],
                    splitLine: {
                        show: false
                    },
                    axisLine: {
                        lineStyle: {
                            color: '#333'
                        }
                    }
                },
                yAxis: {
                    name: '元/人',
                    type: 'value',
                    splitLine: {
                        show: false
                    },
                    axisLine: {
                        lineStyle: {
                            color: '#333'
                        }
                    }
                },
                series: [
                    {
                        name:'总人数',
                        type:'line',
                        data:[ 37,26,31]
                    },
                    {
                        name:'总金额',
                        type:'line',
                        data:[ 32000,36000,48000]
                    }
                ]
            };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
        window.addEventListener("resize", function () {
            myChart.resize();
        });
    }

    //湖南省飞机场
    function echart_5() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('chart_5'));

        function showProvince() {
                var geoCoordMap = {
                    '长沙黄花国际机场': [113.226512,28.192929],
                    '张家界荷花机场': [110.454598,29.107223],
                    '常德桃花源机场': [111.651508,28.921516],
                    '永州零陵机场': [111.622869,26.340994],
                    '怀化芷江机场': [109.714784,27.44615],
                };
                var data = [{
                        name: '长沙黄花国际机场',
                        value: 100
                    },
                    {
                        name: '张家界荷花机场',
                        value: 100
                    },
                    {
                        name: '常德桃花源机场',
                        value: 100
                    },
                    {
                        name: '永州零陵机场',
                        value: 100
                    },
                    {
                        name: '怀化芷江机场',
                        value: 100
                    }
                ];
                var max = 480,
                    min = 9; // todo 
                var maxSize4Pin = 100,
                    minSize4Pin = 20;
                var convertData = function (data) {
                    var res = [];
                    for (var i = 0; i < data.length; i++) {
                        var geoCoord = geoCoordMap[data[i].name];
                        if (geoCoord) {
                            res.push({
                                name: data[i].name,
                                value: geoCoord.concat(data[i].value)
                            });
                        }
                    }
                    return res;
                };

                myChart.setOption(option = {
                    title: {
                        top: 20,
                        text: '',
                        subtext: '',
                        x: 'center',
                        textStyle: {
                            color: '#ccc'
                        }
                    },
                    legend: {
                        orient: 'vertical',
                        y: 'bottom',
                        x: 'right',
                        data: ['pm2.5'],
                        textStyle: {
                            color: '#333'
                        }
                    },
                    visualMap: {
                        show: false,
                        min: 0,
                        max: 500,
                        left: 'left',
                        top: 'bottom',
                        text: ['高', '低'], // 文本，默认为数值文本
                        calculable: true,
                        seriesIndex: [1],
                        inRange: {
                        }
                    },
                    geo: {
                        show: true,
                        map:'hunan',
                        mapType: 'hunan',
                        label: {
                            normal: {
                            },
                            //鼠标移入后查看效果
                            emphasis: {
                                textStyle: {
                                    color: '#fff'
                                }
                            }
                        },
                        //鼠标缩放和平移
                        roam: true,
                        itemStyle: {
                            normal: {
                                //          	color: '#ddd',
                                borderColor: 'rgba(147, 235, 248, 1)',
                                borderWidth: 1,
                                areaColor: {
                                    type: 'radial',
                                    x: 0.5,
                                    y: 0.5,
                                    r: 0.8,
                                    colorStops: [{
                                        offset: 0,
                                        color: 'rgba(175,238,238, 0)' // 0% 处的颜色
                                    }, {
                                        offset: 1,
                                        color: 'rgba(	47,79,79, .2)' // 100% 处的颜色
                                    }],
                                    globalCoord: false // 缺省为 false
                                },
                                shadowColor: 'rgba(128, 217, 248, 1)',
                                shadowOffsetX: -2,
                                shadowOffsetY: 2,
                                shadowBlur: 10
                            },
                            emphasis: {
                                areaColor: '#389BB7',
                                borderWidth: 0
                            }
                        }
                    },
                    series: [{
                            name: 'light',
                            type: 'map',
                            coordinateSystem: 'geo',
                            data: convertData(data),
                            itemStyle: {
                                normal: {
                                    color: '#F4E925'
                                }
                            }
                        },
                        {
                            name: '点',
                            type: 'scatter',
                            coordinateSystem: 'geo',
                            symbol: 'pin',
                            symbolSize: function(val) {
                                var a = (maxSize4Pin - minSize4Pin) / (max - min);
                                var b = minSize4Pin - a * min;
                                b = maxSize4Pin - a * max;
                                return a * val[2] + b;
                            },
                            label: {
                                normal: {
                                    // show: true,
                                    // textStyle: {
                                    //     color: '#fff',
                                    //     fontSize: 9,
                                    // }
                                }
                            },
                            itemStyle: {
                                normal: {
                                    color: '#F62157', //标志颜色
                                }
                            },
                            zlevel: 6,
                            data: convertData(data),
                        },
                        {  
                            name: 'light',
                            type: 'map',
                            mapType: 'hunan',
                            geoIndex: 0,
                            aspectScale: 0.75, //长宽比
                            showLegendSymbol: false, // 存在legend时显示
                            label: {
                                normal: {
                                    show: false
                                },
                                emphasis: {
                                    show: false,
                                    textStyle: {
                                        color: '#fff'
                                    }
                                }
                            },
                            roam: true,
                            itemStyle: {
                                normal: {
                                    areaColor: '#031525',
                                    borderColor: '#FFFFFF',
                                },
                                emphasis: {
                                    areaColor: '#2B91B7'
                                }
                            },
                            animation: false,
                            data: data
                        },
                        {
                            name: ' ',
                            type: 'effectScatter',
                            coordinateSystem: 'geo',
                            data: convertData(data.sort(function (a, b) {
                                return b.value - a.value;
                            }).slice(0, 5)),
                            symbolSize: function (val) {
                                return val[2] / 10;
                            },
                            showEffectOn: 'render',
                            rippleEffect: {
                                brushType: 'stroke'
                            },
                            hoverAnimation: true,
                            label: {
                                normal: {
                                    formatter: '{b}',
                                    position: 'right',
                                    show: true
                                }
                            },
                            itemStyle: {
                                normal: {
                                    color: '#05C3F9',
                                    shadowBlur: 10,
                                    shadowColor: '#05C3F9'
                                }
                            },
                            zlevel: 1
                        },

                    ]
                });
        }
        showProvince();

        // 使用刚指定的配置项和数据显示图表。
        // myChart.setOption(option);
        window.addEventListener("resize", function () {
            myChart.resize();
        });
    }
	
	function echart_6() {
       var myChart =  echarts.init(document.getElementById('chart_6'));

       myChart.clear();
       option = {
               title: {
                   text: ''
               },
               tooltip: {
                   trigger: 'axis'
               },
               legend: {
                   data:['总人数','总金额'],
                   textStyle:{
                       color: '#333'
                   },
                   top: '8%'
               },
               grid: {
                   top: '40%',
                   left: '3%',
                   right: '7%',
                   bottom: '3%',
                   containLabel: true
               },
               color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
               xAxis: {
                   type: 'category',
                   boundaryGap: false,
                   data: ['2019年','2020年','2021年'],
                   splitLine: {
                       show: false
                   },
                   axisLine: {
                       lineStyle: {
                           color: '#333'
                       }
                   },
                   axisLabel: {  
                	   interval:0,  
                	   rotate:40  
                	}
               },
               yAxis: {
                   name: '元/',
                   type: 'value',
                   splitLine: {
                       show: false
                   },
                   axisLine: {
                       lineStyle: {
                           color: '#333'
                       }
                   }
               },
               series: [
                   {
                       name:'总人数',
                       type:'line',
                       data:[ 37,26,31]
                   },
                   {
                       name:'总金额',
                       type:'line',
                       data:[ 32000,36000,48000]
                   }
               ]
           };
       myChart.setOption(option);
    }
	
		
		function echart_7() {
       var myChart =  echarts.init(document.getElementById('chart_7'));

			var app = {};
			 option = {
		               title: {
		                   text: ''
		               },
		               tooltip: {
		                   trigger: 'axis'
		               },
		               legend: {
		                   data:['总人次'],
		                   textStyle:{
		                       color: '#333'
		                   },
		                   top: '8%'
		               },
		               grid: {
		                   top: '40%',
		                   left: '3%',
		                   right: '7%',
		                   bottom: '3%',
		                   containLabel: true
		               },
		               color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
		               xAxis: {
		                   type: 'category',
		                   boundaryGap: false,
		                   data: ['2019年','2020年','2021年'],
		                   splitLine: {
		                       show: false
		                   },
		                   axisLine: {
		                       lineStyle: {
		                           color: '#333'
		                       }
		                   },
		                   axisLabel: {  
		                	   interval:0,  
		                	   rotate:40  
		                	}
		               },
		               yAxis: {
		                   name: '人',
		                   type: 'value',
		                   splitLine: {
		                       show: false
		                   },
		                   axisLine: {
		                       lineStyle: {
		                           color: '#333'
		                       }
		                   }
		               },
		               series: [
		                   {
		                       name:'总人次',
		                       type:'line',
		                       data:[ 57,46,31]
		                   }
		               ]
		           };     

		if (option && typeof option === 'object') {
			myChart.setOption(option);
		}

    }
	function echart_8() {
       var myChart =  echarts.init(document.getElementById('chart_8'));

			var app = {};
			var option;

			 option = {
		               title: {
		                   text: ''
		               },
		               tooltip: {
		                   trigger: 'axis'
		               },
		               legend: {
		                   data:['总人次'],
		                   textStyle:{
		                       color: '#333'
		                   },
		                   top: '8%'
		               },
		               grid: {
		                   top: '40%',
		                   left: '3%',
		                   right: '7%',
		                   bottom: '3%',
		                   containLabel: true
		               },
		               color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
		               xAxis: {
		                   type: 'category',
		                   boundaryGap: false,
		                   data: ['2019年','2020年','2021年'],
		                   splitLine: {
		                       show: false
		                   },
		                   axisLine: {
		                       lineStyle: {
		                           color: '#333'
		                       }
		                   },
		                   axisLabel: {  
		                	   interval:0,  
		                	   rotate:40  
		                	}
		               },
		               yAxis: {
		                   name: '人',
		                   type: 'value',
		                   splitLine: {
		                       show: false
		                   },
		                   axisLine: {
		                       lineStyle: {
		                           color: '#333'
		                       }
		                   }
		               },
		               series: [
		                   {
		                       name:'总人次',
		                       type:'line',
		                       data:[ 77,98,112]
		                   }
		               ]
		           }; 

			if (option && typeof option === 'object') {
				myChart.setOption(option);
			}
    }
	
		function echart_9() {
       var myChart =  echarts.init(document.getElementById('chart_9'));

			var app = {};
			var option;


			 option = {
		               title: {
		                   text: ''
		               },
		               tooltip: {
		                   trigger: 'axis'
		               },
		               legend: {
		                   data:['中央补贴','地方补贴','其他补贴'],
		                   textStyle:{
		                       color: '#333'
		                   },
		                   top: '8%'
		               },
		               grid: {
		                   top: '40%',
		                   left: '3%',
		                   right: '7%',
		                   bottom: '3%',
		                   containLabel: true
		               },
		               color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
		               xAxis: {
		                   type: 'category',
		                   boundaryGap: false,
		                   data: ['2019年','2020年','2021年'],
		                   splitLine: {
		                       show: false
		                   },
		                   axisLine: {
		                       lineStyle: {
		                           color: '#333'
		                       }
		                   },
		                   axisLabel: {  
		                	   interval:0,  
		                	   rotate:40  
		                	}
		               },
		               yAxis: {
		                   name: '元',
		                   type: 'value',
		                   splitLine: {
		                       show: false
		                   },
		                   axisLine: {
		                       lineStyle: {
		                           color: '#333'
		                       }
		                   }
		               },
		               series: [
		                   {
		                       name:'中央补贴',
		                       type:'line',
		                       data:[ 7700,9800,11200]
		                   },
		                   {
		                       name:'地方补贴',
		                       type:'line',
		                       data:[ 7070,9080,10102]
		                   },
		                   {
		                       name:'其他补贴',
		                       type:'line',
		                       data:[ 9775,1022,1520]
		                   }
		               ]
		           }; 

		if (option && typeof option === 'object') {
			myChart.setOption(option);
		}
    }
		 function echart_10() {
		        // 基于准备好的dom，初始化echarts实例
		        var myChart = echarts.init(document.getElementById('chart_10'));
		        myChart.clear();
		        option = {
			            title: {
			                text: ''
			            },
			            tooltip: {
			                trigger: 'axis'
			            },
			            legend: {
			                data:['视力','听力','言语','肢体','智力','精神','多重'],
			                textStyle:{
			                    color: '#333'
			                },
			                top: '8%'
			            },
			            grid: {
			                top: '40%',
			                left: '3%',
			                right: '7%',
			                bottom: '3%',
			                containLabel: true
			            },
			            color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
			            xAxis: {
			                type: 'category',
			                boundaryGap: false,
			                data: ['2019','2020','2021'],
			                splitLine: {
			                    show: false
			                },
			                axisLine: {
			                    lineStyle: {
			                        color: '#333'
			                    }
			                }
			            },
			            yAxis: {
			                name: '人',
			                type: 'value',
			                splitLine: {
			                    show: false
			                },
			                axisLine: {
			                    lineStyle: {
			                        color: '#333'
			                    }
			                }
			            },
			            series: [
			                {
			                    name:'视力',
			                    type:'line',
			                    data:[ 37,40,41]
			                },
			                {
			                    name:'听力',
			                    type:'line',
			                    data:[ 32,56,77]
			                },
			                {
			                    name:'言语',
			                    type:'line',
			                    data:[15,55,12]
			                },
			                {
			                    name:'肢体',
			                    type:'line',
			                    data:[55,12,99]
			                },
			                {
			                    name:'智力',
			                    type:'line',
			                    data:[72,22,88]
			                },
			                {
			                    name:'精神',
			                    type:'line',
			                    data:[13,33,11]
			                },
			                {
			                    name:'多重',
			                    type:'line',
			                    data:[16,44,22]
			                }
			            ]
			        };
		        myChart.setOption(option);
		    }


		    //echart_3货物周转量
		    function echart_11(list) {
		        // 基于准备好的dom，初始化echarts实例
		        var myChart = echarts.init(document.getElementById('chart_11'));
		    	/*var arr=[];
				 for(var i=0;i<list.length;i++){
					list[i].nf
				 }*/
		        myChart.clear();
		        option = {
		            title: {
		                text: ''
		            },
		            tooltip: {
		                trigger: 'axis'
		            },
		            legend: {
		                data:['学杂费补助','住房补助','临时补助'],
		                textStyle:{
		                    color: '#333'
		                },
		                top: '8%'
		            },
		            grid: {
		                top: '40%',
		                left: '3%',
		                right: '7%',
		                bottom: '3%',
		                containLabel: true
		            },
		            color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
		            xAxis: {
		                type: 'category',
		                boundaryGap: false,
		                data: ['2019','2020','2021'],
		                splitLine: {
		                    show: false
		                },
		                axisLine: {
		                    lineStyle: {
		                        color: '#333'
		                    }
		                }
		            },
		            yAxis: {
		                name: '元',
		                type: 'value',
		                splitLine: {
		                    show: false
		                },
		                axisLine: {
		                    lineStyle: {
		                        color: '#333'
		                    }
		                }
		            },
		            series: [
		                {
		                    name:'学杂费补助',
		                    type:'line',
		                    data:[ 3700,4000,4100]
		                },
		                {
		                    name:'住房补助',
		                    type:'line',
		                    data:[ 3200,5600,7700]
		                },
		                {
		                    name:'临时补助',
		                    type:'line',
		                    data:[ 1500,5500,1200]
		                }
		            ]
		        };
		        myChart.setOption(option);
		    }
    //点击跳转
    // $('#chart_map').click(function(){
    //     window.location.href = './page/index.html';
    // });
    // $('.t_btn2').click(function(){
    //     window.location.href = "./page/index.html?id=2";
    // });
    // $('.t_btn3').click(function(){
    //     window.location.href = "./page/index.html?id=3";
    // });
    // $('.t_btn4').click(function(){
    //     window.location.href = "./page/index.html?id=4";
    // });
    // $('.t_btn5').click(function(){
    //     window.location.href = "./page/index.html?id=5";
    // });
    // $('.t_btn6').click(function(){
    //     window.location.href = "./page/index.html?id=6";
    // });
    // $('.t_btn7').click(function(){
    //     window.location.href = "./page/index.html?id=7";
    // });
    // $('.t_btn8').click(function(){
    //     window.location.href = "./page/index.html?id=8";
    // });
    // $('.t_btn9').click(function(){
    //     window.location.href = "./page/index.html?id=9";
    // });
});
